package com.qf.web.controller;


import com.qf.dao.SetMealAdd;
import com.qf.entity.Result;
import com.qf.entity.SetMeal;
import com.qf.service.DeleteService;
import com.qf.service.SetMealAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/setmealadd")
public class SetMealAddController {
    @Autowired
    private SetMealAddService setMealAddService;
    @Autowired
    private DeleteService deleteService;
    @Autowired
    private SetMealAdd setMealAdd;

    @PostMapping
    public Result setadd(Integer[] checkgroupIds,@RequestBody SetMeal formDate){
        setMealAddService.setMealAdd(checkgroupIds,formDate);
        return Result.success(null);
    }
    @PostMapping("/xiugai")
    public Result setbug(Integer[] checkgroupIds,@RequestBody SetMeal formDate){
        String code = formDate.getCode();
        Integer uid = setMealAdd.chaxun(code);
        deleteService.Delete1(uid);
        deleteService.Delete(uid);
        setMealAddService.setMealAdd(checkgroupIds,formDate);
        return Result.success(null);
    }
}
